<?php
namespace MyContent\Controller;

use Zend\Mvc\Controller\AbstractActionController, Zend\View\Model\ViewModel;
use Zend\View\Model\JsonModel;

class IndexController extends AbstractActionController
{
	protected $contentTable;
	
	private $greetingService;
	
	public function indexAction()
	{	
		$greetingSrv = $this->getServiceLocator()->get('greetingService');
		
		$view = new JsonModel(array('AjaxContent' => $greetingSrv->getGreeting()));		
		
		return array('content' => $greetingSrv->getGreeting());		
	}
	
	public function setGreetingService($service)
	{
		$this->greetingService = $service;
	}
	
	public function getContentTable()
	{
		if(!$this->contentTable)
		{
			$sm = $this->getServiceLocator();
			$this->contentTable = $sm->get('MyContent\Model\ContentTable');
		}
		return $this->contentTable;
	}
	
}


